<!DOCTYPE html>
<html lang="en">
<head><meta name="generator" content="Hexo 3.9.0">
    <meta charset="utf-8">
<meta name="google-site-verification" content="phJt8wJDQkOAcEQmqF8UasrF3CVtKMYLBqYLlWfVIOM">
<title>About Mysql Partition - Liyuliang&#39;s Blog</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">



    <meta name="description" content="Server environment12345$ cat /etc/issueUbuntu 14.04.5 LTS$ mysqld -Vmysqld  Ver 5.5.58-0ubuntu0.14.04.1 for debian-linux-gnu on x86_64 ((Ubuntu))">
<meta name="keywords" content="Ubuntu,Mysql,Partition">
<meta property="og:type" content="article">
<meta property="og:title" content="About Mysql Partition">
<meta property="og:url" content="https://liyuliang.cc/2017/08/26/About-Mysql-Partition/index.html">
<meta property="og:site_name" content="Liyuliang&#39;s Blog">
<meta property="og:description" content="Server environment12345$ cat /etc/issueUbuntu 14.04.5 LTS$ mysqld -Vmysqld  Ver 5.5.58-0ubuntu0.14.04.1 for debian-linux-gnu on x86_64 ((Ubuntu))">
<meta property="og:locale" content="en">
<meta property="og:updated_time" content="2021-06-14T14:02:02.291Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="About Mysql Partition">
<meta name="twitter:description" content="Server environment12345$ cat /etc/issueUbuntu 14.04.5 LTS$ mysqld -Vmysqld  Ver 5.5.58-0ubuntu0.14.04.1 for debian-linux-gnu on x86_64 ((Ubuntu))">





<link rel="icon" href="/images/header.png">


<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.7.2/css/bulma.css">
<link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/5.4.1/css/all.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu:400,600|Source+Code+Pro">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@9.12.0/styles/atom-one-light.css">


    
    
    
    <style>body>.footer,body>.navbar,body>.section{opacity:0}</style>
    

    
    
    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/lightgallery@1.6.8/dist/css/lightgallery.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/css/justifiedGallery.min.css">
    

    
    

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/outdatedbrowser@1.1.5/outdatedbrowser/outdatedbrowser.min.css">


    
    
    
    

<link rel="stylesheet" href="/css/back-to-top.css">


    
    

    
    
    
    

    
    
<link rel="stylesheet" href="/css/progressbar.css">
<script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>

    
    
    

    


<script>
        if (document.domain != "liyuliang.cc") {
            window.location.href = "https://liyuliang.cc";
        }
        if (top.location != self.location) {
           top.location = self.location;
        }

</script>
<link rel="stylesheet" href="/css/style.css">

</head>
<body class="is-2-column">
    <nav class="navbar navbar-main">
    <div class="container">
        <div class="navbar-brand is-flex-center">
            <a class="navbar-item navbar-logo" href="/">
            
                Liyuliang&#39;s Blog
            
            </a>
        </div>
        <div class="navbar-menu">
            
            <div class="navbar-start">
                
                <a class="navbar-item" href="/archives">Archives</a>
                
            </div>
            
            <div class="navbar-end">
                
                    
                    
                    <a class="navbar-item" target="_blank" title="Download on GitHub" href="https://github.com/liyuliang">
                        
                        <i class="fab fa-github"></i>
                        
                    </a>
                    
                
                
                
                <a class="navbar-item search" title="Search" href="javascript:;">
                    <i class="fas fa-search"></i>
                </a>
                
            </div>
        </div>
    </div>
</nav>
    
    <section class="section">
        <div class="container">
            <div class="columns">
                <div class="column is-8-tablet is-8-desktop is-8-widescreen has-order-2 column-main"><div class="card">
    
    <div class="card-content article ">
        
        <div class="level article-meta is-size-7 is-uppercase is-mobile is-overflow-x-auto">
            <div class="level-left">
                <time class="level-item has-text-grey" datetime="2017-08-26T12:43:47.000Z">2017-08-26</time>
                
                
                <span class="level-item has-text-grey">
                    
                    
                    10 minutes read (About 1434 words)
                </span>
                
            </div>
        </div>
        
        <h1 class="title is-size-3 is-size-4-mobile has-text-weight-normal">
            
                About Mysql Partition
            
        </h1>
        <div class="content">
            <h3 id="Server-environment"><a href="#Server-environment" class="headerlink" title="Server environment"></a>Server environment</h3><figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">$ cat /etc/issue</span><br><span class="line">Ubuntu 14.04.5 LTS</span><br><span class="line"></span><br><span class="line">$ mysqld -V</span><br><span class="line">mysqld  Ver 5.5.58-0ubuntu0.14.04.1 for debian-linux-gnu on x86_64 ((Ubuntu))</span><br></pre></td></tr></table></figure>

<a id="more"></a>

<h3 id="Check-Mysql-support"><a href="#Check-Mysql-support" class="headerlink" title="Check Mysql support"></a>Check Mysql support</h3><p>Mysql version is required at least 5.1 to using partition.<br>Check currency database version whether the partition is supported.</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">mysql&gt; show variables like &apos;%partition%&apos;;</span><br><span class="line">+-------------------+-------+</span><br><span class="line">| Variable_name     | Value |</span><br><span class="line">+-------------------+-------+</span><br><span class="line">| have_partitioning | YES   |</span><br><span class="line">+-------------------+-------+</span><br><span class="line">1 row in set (0.00 sec)</span><br></pre></td></tr></table></figure>

<h3 id="RANGE"><a href="#RANGE" class="headerlink" title="RANGE"></a>RANGE</h3><p>Assign the records to different partition based on the range of store id(0-6,7-11,12-16,17-21,&gt;21).</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">CREATE TABLE employees_range (</span><br><span class="line">    id INT NOT NULL,</span><br><span class="line">    fname VARCHAR(30),</span><br><span class="line">    lname VARCHAR(30),</span><br><span class="line">    hired DATE NOT NULL DEFAULT &apos;1970-01-01&apos;,</span><br><span class="line">    separated DATE NOT NULL DEFAULT &apos;9999-12-31&apos;,</span><br><span class="line">    job_code INT NOT NULL,</span><br><span class="line">    store_id INT NOT NULL</span><br><span class="line">)</span><br><span class="line">partition BY RANGE (store_id) (</span><br><span class="line">    partition p0 VALUES LESS THAN (6),</span><br><span class="line">    partition p1 VALUES LESS THAN (11),</span><br><span class="line">    partition p2 VALUES LESS THAN (16),</span><br><span class="line">    partition p3 VALUES LESS THAN (21),</span><br><span class="line">    partition p4 VALUES LESS THAN MAXVALUE</span><br><span class="line">);</span><br></pre></td></tr></table></figure>

<ul>
<li>Add partition can only increase by value, don’t use the MAXVALUE  </li>
<li>If defined the MAXVALUE, partition can not be extended.</li>
</ul>
<h3 id="LIST"><a href="#LIST" class="headerlink" title="LIST"></a>LIST</h3><p>Assign the records to different partition based on the specified store ids.</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">CREATE TABLE employees_list (</span><br><span class="line">    id INT NOT NULL,</span><br><span class="line">    fname VARCHAR(30),</span><br><span class="line">    lname VARCHAR(30),</span><br><span class="line">    hired DATE NOT NULL DEFAULT &apos;1970-01-01&apos;,</span><br><span class="line">    separated DATE NOT NULL DEFAULT &apos;9999-12-31&apos;,</span><br><span class="line">    job_code INT,</span><br><span class="line">    store_id INT</span><br><span class="line">)</span><br><span class="line">PARTITION BY LIST(store_id) (</span><br><span class="line">    PARTITION pNorth VALUES IN (3,5,6,9,17),</span><br><span class="line">    PARTITION pEast VALUES IN (1,2,10,11,19,20),</span><br><span class="line">    PARTITION pWest VALUES IN (4,12,13,14,18),</span><br><span class="line">    PARTITION pCentral VALUES IN (7,8,15,16)</span><br><span class="line">);</span><br></pre></td></tr></table></figure>

<h3 id="HASH"><a href="#HASH" class="headerlink" title="HASH"></a>HASH</h3><p>Assign the records to different partition based on customer expression’s return value.</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">CREATE TABLE employees_hash (</span><br><span class="line">    id INT NOT NULL,</span><br><span class="line">    fname VARCHAR(30),</span><br><span class="line">    lname VARCHAR(30),</span><br><span class="line">    hired DATE NOT NULL DEFAULT &apos;1970-01-01&apos;,</span><br><span class="line">    separated DATE NOT NULL DEFAULT &apos;9999-12-31&apos;,</span><br><span class="line">    job_code INT,</span><br><span class="line">    store_id INT</span><br><span class="line">)</span><br><span class="line">PARTITION BY HASH(YEAR(hired))</span><br><span class="line">PARTITIONS 4;</span><br></pre></td></tr></table></figure>

<p>PARTITIONS 4: the number of partition is 4</p>
<h3 id="KEY"><a href="#KEY" class="headerlink" title="KEY"></a>KEY</h3><p>Similar to the HASH partition, KEY partition only supports one or more columns.</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">CREATE TABLE employees_key (</span><br><span class="line">    id INT NOT NULL,</span><br><span class="line">    fname VARCHAR(30),</span><br><span class="line">    lname VARCHAR(30),</span><br><span class="line">    hired DATE NOT NULL DEFAULT &apos;1970-01-01&apos;,</span><br><span class="line">    separated DATE NOT NULL DEFAULT &apos;9999-12-31&apos;,</span><br><span class="line">    job_code INT,</span><br><span class="line">    store_id INT</span><br><span class="line">)</span><br><span class="line">PARTITION BY HASH (id) PARTITIONS 10;</span><br></pre></td></tr></table></figure>

<p>Created a total of 10 partitions<br>If Mysql configuration ‘innodb_file_per_table &#x3D; 1’ is true, each partition table has its own separate file </p>
<ul>
<li>Linear hash partition: When the number of linear hash partition is n times 2, the result of linear hash partition is consistent with the result of regular hash partition</li>
</ul>
<h3 id="Check-Partition"><a href="#Check-Partition" class="headerlink" title="Check Partition"></a>Check Partition</h3><figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">mysql&gt; SELECT PARTITION_NAME,TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = &apos;employees_range&apos;;</span><br><span class="line">+----------------+------------+</span><br><span class="line">| PARTITION_NAME | TABLE_ROWS |</span><br><span class="line">+----------------+------------+</span><br><span class="line">| p0             |          0 |</span><br><span class="line">| p1             |          0 |</span><br><span class="line">| p2             |          0 |</span><br><span class="line">| p3             |          0 |</span><br><span class="line">| p4             |          0 |</span><br><span class="line">+----------------+------------+</span><br><span class="line">5 rows in set (0.00 sec)</span><br></pre></td></tr></table></figure>

<h3 id="Increase-partition-in-no-partition-table"><a href="#Increase-partition-in-no-partition-table" class="headerlink" title="Increase partition in no partition table"></a>Increase partition in no partition table</h3><p>Chekc users table structure </p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">mysql&gt; show create table users;</span><br><span class="line">+-------+-----------------------------+</span><br><span class="line">| Table | Create Table                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |</span><br><span class="line">+-------+-----------------------------+</span><br><span class="line">| users | CREATE TABLE `users` (</span><br><span class="line">    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,</span><br><span class="line">    ...</span><br><span class="line">    ...</span><br><span class="line">    `created_at` timestamp NULL DEFAULT NULL,</span><br><span class="line">    PRIMARY KEY (`id`),</span><br><span class="line">    KEY `country_age_income` (`country`,`age`,`sex`,`income`)</span><br><span class="line">  ) ENGINE=MyISAM AUTO_INCREMENT=110305176 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci |</span><br><span class="line">+-------+----------------------------+</span><br><span class="line">1 row in set (0.00 sec)</span><br></pre></td></tr></table></figure>

<p>Add partition</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">mysql&gt; ALTER TABLE users PARTITION BY HASH (id) PARTITIONS 10;</span><br><span class="line">ERROR 1503 (HY000): A UNIQUE INDEX must include all columns in the table&apos;s partitioning function</span><br></pre></td></tr></table></figure>

<p>The partition filed id must be included in the primary key (id ,country_age_income). So remove the previous index for test.</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">mysql&gt; drop index `country_age_income` on users;</span><br><span class="line">Query OK, 10150175 rows affected (6 min 15.40 sec)</span><br><span class="line">Records: 10150175  Duplicates: 0  Warnings: 0</span><br></pre></td></tr></table></figure>

<p>Re-execute</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">mysql&gt; ALTER TABLE users PARTITION BY HASH (id) PARTITIONS 10;</span><br><span class="line">Query OK, 10150175 rows affected (49.95 sec)</span><br><span class="line">Records: 10150175  Duplicates: 0  Warnings: 0</span><br><span class="line"></span><br><span class="line">mysql&gt; SELECT PARTITION_NAME,TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = &apos;users&apos;;</span><br><span class="line">+----------------+------------+</span><br><span class="line">| PARTITION_NAME | TABLE_ROWS |</span><br><span class="line">+----------------+------------+</span><br><span class="line">| p0             |    1015017 |</span><br><span class="line">| p1             |    1015018 |</span><br><span class="line">| p2             |    1015018 |</span><br><span class="line">| p3             |    1015018 |</span><br><span class="line">| p4             |    1015018 |</span><br><span class="line">| p5             |    1015018 |</span><br><span class="line">| p6             |    1015017 |</span><br><span class="line">| p7             |    1015017 |</span><br><span class="line">| p8             |    1015017 |</span><br><span class="line">| p9             |    1015017 |</span><br><span class="line">+----------------+------------+</span><br><span class="line">11 rows in set (0.01 sec)</span><br></pre></td></tr></table></figure>

<p>Selected a few id to test the partition</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">mysql&gt; explain partitions select * from users where id = 230;</span><br><span class="line">+----+-------------+-------+------------+-------+---------------+---------+---------+-------+------+-------+</span><br><span class="line">| id | select_type | table | partitions | type  | possible_keys | key     | key_len | ref   | rows | Extra |</span><br><span class="line">+----+-------------+-------+------------+-------+---------------+---------+---------+-------+------+-------+</span><br><span class="line">|  1 | SIMPLE      | users | p0     | const | PRIMARY       | PRIMARY | 4       | const |    1 |       |</span><br><span class="line">+----+-------------+-------+------------+-------+---------------+---------+---------+-------+------+-------+</span><br><span class="line">1 row in set (0.00 sec)</span><br><span class="line"></span><br><span class="line">mysql&gt; explain partitions select * from users where id = 231;</span><br><span class="line">+----+-------------+-------+------------+-------+---------------+---------+---------+-------+------+-------+</span><br><span class="line">| id | select_type | table | partitions | type  | possible_keys | key     | key_len | ref   | rows | Extra |</span><br><span class="line">+----+-------------+-------+------------+-------+---------------+---------+---------+-------+------+-------+</span><br><span class="line">|  1 | SIMPLE      | users | p1     | const | PRIMARY       | PRIMARY | 4       | const |    1 |       |</span><br><span class="line">+----+-------------+-------+------------+-------+---------------+---------+---------+-------+------+-------+</span><br><span class="line">1 row in set (0.01 sec)</span><br><span class="line"></span><br><span class="line">mysql&gt; explain partitions select * from users where id = 232;</span><br><span class="line">+----+-------------+-------+------------+-------+---------------+---------+---------+-------+------+-------+</span><br><span class="line">| id | select_type | table | partitions | type  | possible_keys | key     | key_len | ref   | rows | Extra |</span><br><span class="line">+----+-------------+-------+------------+-------+---------------+---------+---------+-------+------+-------+</span><br><span class="line">|  1 | SIMPLE      | users | p2     | const | PRIMARY       | PRIMARY | 4       | const |    1 |       |</span><br><span class="line">+----+-------------+-------+------------+-------+---------------+---------+---------+-------+------+-------+</span><br><span class="line">1 row in set (0.01 sec)</span><br></pre></td></tr></table></figure>

<p>Check users table partition file structure</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">$ ls -lh /var/lib/mysql/app/users*</span><br><span class="line">-rw-rw---- 1 mysql mysql  17K /var/lib/mysql/app/users.frm</span><br><span class="line">-rw-rw---- 1 mysql mysql   60 /var/lib/mysql/app/users.par</span><br><span class="line">-rw-rw---- 1 mysql mysql 453M /var/lib/mysql/app/users#P#p0.MYD</span><br><span class="line">-rw-rw---- 1 mysql mysql  10M /var/lib/mysql/app/users#P#p0.MYI</span><br><span class="line">-rw-rw---- 1 mysql mysql 453M /var/lib/mysql/app/users#P#p1.MYD</span><br><span class="line">-rw-rw---- 1 mysql mysql  10M /var/lib/mysql/app/users#P#p1.MYI</span><br><span class="line">-rw-rw---- 1 mysql mysql 453M /var/lib/mysql/app/users#P#p2.MYD</span><br><span class="line">-rw-rw---- 1 mysql mysql  10M /var/lib/mysql/app/users#P#p2.MYI</span><br><span class="line">-rw-rw---- 1 mysql mysql 453M /var/lib/mysql/app/users#P#p3.MYD</span><br><span class="line">-rw-rw---- 1 mysql mysql  10M /var/lib/mysql/app/users#P#p3.MYI</span><br><span class="line">-rw-rw---- 1 mysql mysql 453M /var/lib/mysql/app/users#P#p4.MYD</span><br><span class="line">-rw-rw---- 1 mysql mysql  10M /var/lib/mysql/app/users#P#p4.MYI</span><br><span class="line">-rw-rw---- 1 mysql mysql 453M /var/lib/mysql/app/users#P#p5.MYD</span><br><span class="line">-rw-rw---- 1 mysql mysql  10M /var/lib/mysql/app/users#P#p5.MYI</span><br><span class="line">-rw-rw---- 1 mysql mysql 453M /var/lib/mysql/app/users#P#p6.MYD</span><br><span class="line">-rw-rw---- 1 mysql mysql  10M /var/lib/mysql/app/users#P#p6.MYI</span><br><span class="line">-rw-rw---- 1 mysql mysql 453M /var/lib/mysql/app/users#P#p7.MYD</span><br><span class="line">-rw-rw---- 1 mysql mysql  10M /var/lib/mysql/app/users#P#p7.MYI</span><br><span class="line">-rw-rw---- 1 mysql mysql 453M /var/lib/mysql/app/users#P#p8.MYD</span><br><span class="line">-rw-rw---- 1 mysql mysql  10M /var/lib/mysql/app/users#P#p8.MYI</span><br><span class="line">-rw-rw---- 1 mysql mysql 453M /var/lib/mysql/app/users#P#p9.MYD</span><br><span class="line">-rw-rw---- 1 mysql mysql  10M /var/lib/mysql/app/users#P#p9.MYI</span><br></pre></td></tr></table></figure>

<h3 id="Specify-the-partition-file-directory"><a href="#Specify-the-partition-file-directory" class="headerlink" title="Specify the partition file directory"></a>Specify the partition file directory</h3><p>MYISAM storage engine can define the data file directory and index file directory separately.<br>INNODB storage engine can only define the the data directory.</p>
<p>Whether InnoDB or MyISAM, can not use <code>alter table</code> to modify the data file location.</p>
<ul>
<li>MYISAM</li>
</ul>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line">CREATE TABLE partition_myisam (</span><br><span class="line">      id INT AUTO_INCREMENT,</span><br><span class="line">      store_id INT,</span><br><span class="line">      order_date DATE,</span><br><span class="line">      INDEX idx (id)</span><br><span class="line">) ENGINE = MYISAM</span><br><span class="line">PARTITION BY LIST(store_id) (</span><br><span class="line">      PARTITION p1</span><br><span class="line">      VALUES IN (1, 3, 4, 17)</span><br><span class="line">     DATA DIRECTORY = &apos;/data/data&apos;</span><br><span class="line">      INDEX DIRECTORY = &apos;/data/idx&apos;,</span><br><span class="line">      PARTITION p2</span><br><span class="line">      VALUES IN (2, 12, 14)</span><br><span class="line">     DATA DIRECTORY = &apos;/data/data&apos;</span><br><span class="line">      INDEX DIRECTORY = &apos;/data/idx&apos;,</span><br><span class="line">      PARTITION p3</span><br><span class="line">      VALUES IN (6, 8, 20)</span><br><span class="line">     DATA DIRECTORY = &apos;/data/data&apos;</span><br><span class="line">      INDEX DIRECTORY = &apos;/data/idx&apos;,</span><br><span class="line">      PARTITION p4</span><br><span class="line">      VALUES IN (5, 7, 9, 11, 16)</span><br><span class="line">     DATA DIRECTORY = &apos;/data/data&apos;</span><br><span class="line">      INDEX DIRECTORY = &apos;/data/idx&apos;,</span><br><span class="line">      PARTITION p5</span><br><span class="line">      VALUES IN (10, 13, 15, 18)</span><br><span class="line">     DATA DIRECTORY = &apos;/data/data&apos;</span><br><span class="line">      INDEX DIRECTORY = &apos;/data/idx&apos;</span><br><span class="line">);</span><br></pre></td></tr></table></figure>

<ul>
<li>INNODB</li>
</ul>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">CREATE TABLE partition_innodb (</span><br><span class="line">      id INT AUTO_INCREMENT,</span><br><span class="line">      store_id INT,</span><br><span class="line">      order_date DATE,</span><br><span class="line">      INDEX idx (id)</span><br><span class="line">) ENGINE = INNODB</span><br><span class="line">PARTITION BY LIST(store_id) (</span><br><span class="line">      PARTITION p1</span><br><span class="line">      VALUES IN (1, 3, 4, 17)</span><br><span class="line">      DATA DIRECTORY = &apos;/data/EN&apos;,</span><br><span class="line">      PARTITION p2</span><br><span class="line">      VALUES IN (2, 12, 14)</span><br><span class="line">      DATA DIRECTORY = &apos;/data/CN&apos;,</span><br><span class="line">      PARTITION p3</span><br><span class="line">      VALUES IN (6, 8, 20)</span><br><span class="line">      DATA DIRECTORY = &apos;/data/JP&apos;,</span><br><span class="line">      PARTITION p4</span><br><span class="line">      VALUES IN (5, 7, 9, 11, 16)</span><br><span class="line">      DATA DIRECTORY = &apos;/data/GB&apos;,</span><br><span class="line">      PARTITION p5</span><br><span class="line">      VALUES IN (10, 13, 15, 18)</span><br><span class="line">      DATA DIRECTORY = &apos;/data/HK&apos;</span><br><span class="line">);</span><br></pre></td></tr></table></figure>

<p>If you got this error, make sure the data directory exist and right power</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ERROR 1030 (HY000): Got error 168 from storage engine</span><br></pre></td></tr></table></figure>

<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ mkdir /data; chown -R mysql:mysql /data/</span><br></pre></td></tr></table></figure>

<ul>
<li>Insert data</li>
</ul>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">insert into partition_myisam(id, store_id) values(1, 1);</span><br><span class="line">insert into partition_myisam(id, store_id) values(2, 2);</span><br><span class="line">insert into partition_myisam(id, store_id) values(6, 6);</span><br><span class="line">insert into partition_myisam(id, store_id) values(8, 8);</span><br><span class="line">insert into partition_myisam(id, store_id) values(5, 5);</span><br><span class="line">insert into partition_myisam(id, store_id) values(9, 9);</span><br><span class="line"></span><br><span class="line">insert into partition_innodb(id, store_id) values(1, 1);</span><br><span class="line">insert into partition_innodb(id, store_id) values(2, 2);</span><br><span class="line">insert into partition_innodb(id, store_id) values(6, 6);</span><br><span class="line">insert into partition_innodb(id, store_id) values(8, 8);</span><br><span class="line">insert into partition_innodb(id, store_id) values(5, 5);</span><br><span class="line">insert into partition_innodb(id, store_id) values(9, 9);</span><br></pre></td></tr></table></figure>

<ul>
<li>Check data file distributed</li>
</ul>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">$ tree /data </span><br><span class="line">.</span><br><span class="line">|-- CN</span><br><span class="line">|   `-- test</span><br><span class="line">|       `-- partition_innodb#P#p2.ibd</span><br><span class="line">|-- EN</span><br><span class="line">|   `-- test</span><br><span class="line">|       `-- partition_innodb#P#p1.ibd</span><br><span class="line">|-- GB</span><br><span class="line">|   `-- test</span><br><span class="line">|       `-- partition_innodb#P#p4.ibd</span><br><span class="line">|-- HK</span><br><span class="line">|   `-- test</span><br><span class="line">|       `-- partition_innodb#P#p5.ibd</span><br><span class="line">|-- JP</span><br><span class="line">|   `-- test</span><br><span class="line">|       `-- partition_innodb#P#p3.ibd</span><br></pre></td></tr></table></figure>

<h3 id="Meet-some-errors"><a href="#Meet-some-errors" class="headerlink" title="Meet some errors"></a>Meet some errors</h3><ul>
<li><h5 id="MyISAM-specified-data-directory-is-nvalid"><a href="#MyISAM-specified-data-directory-is-nvalid" class="headerlink" title="MyISAM specified data directory is nvalid"></a>MyISAM specified data directory is nvalid</h5>The version 5.5 is no problem.</li>
</ul>
<p>Version 5.7.12 will appear warning. The data directory is still the default directory.<br>InnoDB data files can not use the same way as MyISAM label link specified data files.</p>
<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">mysql&gt; SHOW VARIABLES LIKE &apos;have_symlink&apos;; </span><br><span class="line">+---------------+----------+</span><br><span class="line">| Variable_name | Value    |</span><br><span class="line">+---------------+----------+</span><br><span class="line">| have_symlink  | DISABLED |</span><br><span class="line">+---------------+----------+</span><br></pre></td></tr></table></figure>

<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ vim /etc/mysql/conf.d/mysql.cnf</span><br><span class="line"></span><br><span class="line">symbolic-links=1    # Change to 1 than enable the symbolic link</span><br></pre></td></tr></table></figure>

<figure class="highlight plain hljs"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo service mysql restart</span><br></pre></td></tr></table></figure>


        </div>
        
        <div class="level is-size-7 is-uppercase">
            <div class="level-start">
                <div class="level-item">
                    <span class="is-size-6 has-text-grey has-mr-7">#</span>
                    <a class="has-link-grey -link" href="/tags/Mysql/">Mysql</a>, <a class="has-link-grey -link" href="/tags/Partition/">Partition</a>, <a class="has-link-grey -link" href="/tags/Ubuntu/">Ubuntu</a>
                </div>
            </div>
        </div>
        
        
        
            <p class="is-size-7">
    <b>
    Thank you for reading.<br>
    This post is copyrighted by <a href="https://liyuliang.cc">Liyuliang’s Blog.</a><br>
    If reproduced, please indicate the source: <a href="https://liyuliang.cc">Liyuliang’s Blog</a><br>
    This blog uses <a target="_blank" rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-Share-Sharing 4.0 International License Agreement </a> to license.<br>
    </b>
    <hr>
</p>
        
        
    </div>
</div>



<div class="card">
    <div class="card-content">
        <h3 class="menu-label has-text-centered">Like this article? Support the author with</h3>
        <div class="buttons is-centered">
            
                
<a class="button is-info donate">
    <span class="icon is-small">
        <i class="fab fa-alipay"></i>
    </span>
    <span>Alipay</span>
    <div class="qrcode"><img src="/images/alipay.jpeg" alt="Alipay"></div>
</a>

                
                
<a class="button is-success donate">
    <span class="icon is-small">
        <i class="fab fa-weixin"></i>
    </span>
    <span>Wechat</span>
    <div class="qrcode"><img src="/images/wxpay.jpeg" alt="Wechat"></div>
</a>

                
                <!-- Visit https://www.paypal.com/donate/buttons/ to get your donate button -->

<a class="button is-warning donate" onclick="document.getElementById(&#39;paypal-donate-form&#39;).submit()">
    <span class="icon is-small">
        <i class="fab fa-paypal"></i>
    </span>
    <span>Paypal</span>
</a>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank" id="paypal-donate-form">
    <input type="hidden" name="cmd" value="_donations">
    <input type="hidden" name="business" value="D7RUA6PUE8GM2">
    <input type="hidden" name="currency_code" value="USD">
</form>

                
        </div>
    </div>
</div>



<div class="card card-transparent">
    <div class="level post-navigation is-flex-wrap is-mobile">
        
        <div class="level-start">
            <a class="level level-item has-link-grey  article-nav-prev" href="/2017/08/26/Mysql-Table-Horizontal-Split-By-Mycat/">
                <i class="level-item fas fa-chevron-left"></i>
                <span class="level-item">Mysql Table Horizontal Split By Mycat</span>
            </a>
        </div>
        
        
        <div class="level-end">
            <a class="level level-item has-link-grey  article-nav-next" href="/2017/08/25/Mysql-Specify-Slave-Database-And-Table/">
                <span class="level-item">Mysql Specify Slave Database And Table</span>
                <i class="level-item fas fa-chevron-right"></i>
            </a>
        </div>
        
    </div>
</div>


</div>
                
                




<div class="column is-4-tablet is-4-desktop is-4-widescreen  has-order-3 column-right is-sticky">
    
        <div class="card widget">
    <div class="card-content">
        <div class="menu">
        <h3 class="menu-label">
            Archives
        </h3>
        <ul class="menu-list">
        
        <li>
            <a class="level is-marginless" href="/archives/2018/06/">
                <span class="level-start">
                    <span class="level-item">June 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">3</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/05/">
                <span class="level-start">
                    <span class="level-item">May 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/04/">
                <span class="level-start">
                    <span class="level-item">April 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">1</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/03/">
                <span class="level-start">
                    <span class="level-item">March 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">3</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/02/">
                <span class="level-start">
                    <span class="level-item">February 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">3</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2018/01/">
                <span class="level-start">
                    <span class="level-item">January 2018</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">6</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/12/">
                <span class="level-start">
                    <span class="level-item">December 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">3</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/11/">
                <span class="level-start">
                    <span class="level-item">November 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">2</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/10/">
                <span class="level-start">
                    <span class="level-item">October 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">5</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/09/">
                <span class="level-start">
                    <span class="level-item">September 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">8</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/08/">
                <span class="level-start">
                    <span class="level-item">August 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">10</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/07/">
                <span class="level-start">
                    <span class="level-item">July 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">3</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/06/">
                <span class="level-start">
                    <span class="level-item">June 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">6</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/05/">
                <span class="level-start">
                    <span class="level-item">May 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">9</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/04/">
                <span class="level-start">
                    <span class="level-item">April 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">7</span>
                </span>
            </a>
        </li>
        
        <li>
            <a class="level is-marginless" href="/archives/2017/03/">
                <span class="level-start">
                    <span class="level-item">March 2017</span>
                </span>
                <span class="level-end">
                    <span class="level-item tag">9</span>
                </span>
            </a>
        </li>
        
        </ul>
        </div>
    </div>
</div>
    
        
<div class="card widget">
    <div class="card-content">
        <h3 class="menu-label">
            Tag Cloud
        </h3>
        <a href="/tags/Alipay/" style="font-size: 10px;">Alipay</a> <a href="/tags/Apache/" style="font-size: 12px;">Apache</a> <a href="/tags/Baidu/" style="font-size: 10px;">Baidu</a> <a href="/tags/Canal/" style="font-size: 10px;">Canal</a> <a href="/tags/Centos/" style="font-size: 10px;">Centos</a> <a href="/tags/CloudDisk/" style="font-size: 10px;">CloudDisk</a> <a href="/tags/Daemon/" style="font-size: 11px;">Daemon</a> <a href="/tags/Elasticsearch/" style="font-size: 13px;">Elasticsearch</a> <a href="/tags/Filebeat/" style="font-size: 11px;">Filebeat</a> <a href="/tags/Glide/" style="font-size: 10px;">Glide</a> <a href="/tags/Iterm/" style="font-size: 10px;">Iterm</a> <a href="/tags/JQuery/" style="font-size: 10px;">JQuery</a> <a href="/tags/Keepalived/" style="font-size: 10px;">Keepalived</a> <a href="/tags/Kibana/" style="font-size: 11px;">Kibana</a> <a href="/tags/Linux/" style="font-size: 10px;">Linux</a> <a href="/tags/Login/" style="font-size: 10px;">Login</a> <a href="/tags/Logstash/" style="font-size: 11px;">Logstash</a> <a href="/tags/Mac/" style="font-size: 14px;">Mac</a> <a href="/tags/Mongodb/" style="font-size: 11px;">Mongodb</a> <a href="/tags/Mycat/" style="font-size: 10px;">Mycat</a> <a href="/tags/Mysql/" style="font-size: 19px;">Mysql</a> <a href="/tags/NFS/" style="font-size: 10px;">NFS</a> <a href="/tags/Nginx/" style="font-size: 10px;">Nginx</a> <a href="/tags/Nodejs/" style="font-size: 10px;">Nodejs</a> <a href="/tags/PHP/" style="font-size: 18px;">PHP</a> <a href="/tags/Pagespeed/" style="font-size: 10px;">Pagespeed</a> <a href="/tags/Partition/" style="font-size: 10px;">Partition</a> <a href="/tags/Redis/" style="font-size: 12px;">Redis</a> <a href="/tags/Replica/" style="font-size: 10px;">Replica</a> <a href="/tags/Security/" style="font-size: 10px;">Security</a> <a href="/tags/Slave/" style="font-size: 13px;">Slave</a> <a href="/tags/SlowLog/" style="font-size: 11px;">SlowLog</a> <a href="/tags/Symfony/" style="font-size: 15px;">Symfony</a> <a href="/tags/TCP/" style="font-size: 10px;">TCP</a> <a href="/tags/Twig/" style="font-size: 11px;">Twig</a> <a href="/tags/Ubuntu/" style="font-size: 20px;">Ubuntu</a> <a href="/tags/Varnish/" style="font-size: 10px;">Varnish</a> <a href="/tags/Vim/" style="font-size: 10px;">Vim</a> <a href="/tags/Virtualbox/" style="font-size: 10px;">Virtualbox</a> <a href="/tags/Wordpress/" style="font-size: 11px;">Wordpress</a> <a href="/tags/auth/" style="font-size: 11px;">auth</a> <a href="/tags/backup/" style="font-size: 10px;">backup</a> <a href="/tags/beanstalkd/" style="font-size: 10px;">beanstalkd</a> <a href="/tags/binlog/" style="font-size: 10px;">binlog</a> <a href="/tags/blog/" style="font-size: 10px;">blog</a> <a href="/tags/brew/" style="font-size: 11px;">brew</a> <a href="/tags/composer/" style="font-size: 10px;">composer</a> <a href="/tags/cookie/" style="font-size: 10px;">cookie</a> <a href="/tags/css/" style="font-size: 10px;">css</a> <a href="/tags/dante/" style="font-size: 10px;">dante</a> <a href="/tags/docker/" style="font-size: 12px;">docker</a> <a href="/tags/domain/" style="font-size: 11px;">domain</a> <a href="/tags/download/" style="font-size: 10px;">download</a> <a href="/tags/file/" style="font-size: 10px;">file</a> <a href="/tags/fork/" style="font-size: 10px;">fork</a> <a href="/tags/git/" style="font-size: 11px;">git</a> <a href="/tags/github/" style="font-size: 10px;">github</a> <a href="/tags/gitlab/" style="font-size: 10px;">gitlab</a> <a href="/tags/golang/" style="font-size: 17px;">golang</a> <a href="/tags/homestead/" style="font-size: 10px;">homestead</a> <a href="/tags/iptable/" style="font-size: 11px;">iptable</a> <a href="/tags/laravel/" style="font-size: 10px;">laravel</a> <a href="/tags/log/" style="font-size: 10px;">log</a> <a href="/tags/nginx/" style="font-size: 16px;">nginx</a> <a href="/tags/proxy/" style="font-size: 11px;">proxy</a> <a href="/tags/redis-cluster/" style="font-size: 10px;">redis-cluster</a> <a href="/tags/redis-sentinel/" style="font-size: 10px;">redis-sentinel</a> <a href="/tags/sock5/" style="font-size: 10px;">sock5</a> <a href="/tags/supervisor/" style="font-size: 10px;">supervisor</a> <a href="/tags/sync/" style="font-size: 10px;">sync</a> <a href="/tags/tips/" style="font-size: 11px;">tips</a> <a href="/tags/tmux/" style="font-size: 10px;">tmux</a> <a href="/tags/usb/" style="font-size: 10px;">usb</a> <a href="/tags/vagrant/" style="font-size: 10px;">vagrant</a> <a href="/tags/web/" style="font-size: 10px;">web</a>
    </div>
</div>

    
        


    
    
</div>

            </div>
        </div>
    </section>
    <footer class="footer">
    <div class="container">
        <div class="level">
            <div class="level-start has-text-centered-mobile">
                <a class="footer-logo is-block has-mb-6" href="/">
                
                    Liyuliang&#39;s Blog
                
                </a>

                <p class="is-size-7">
                    <a href="/copyright" target="_blank">Copyright</a>
                    &copy; 2022 Liyuliang&nbsp;

		    <a target="_blank" href="https://beian.miit.gov.cn">粤ICP备18120141号</a>
                </p>
            </div>
            <div class="level-end">
            
                <div class="field has-addons is-flex-center-mobile has-mt-5-mobile is-flex-wrap is-flex-middle">
                
                
                <p class="control">
                    <a class="button is-white is-large" target="_blank" title="Creative Commons" href="https://creativecommons.org/">
                        
                        <i class="fab fa-creative-commons"></i>
                        
                    </a>
                </p>
                
                <p class="control">
                    <a class="button is-white is-large" target="_blank" title="Attribution 4.0 International" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">
                        
                        <i class="fab fa-creative-commons-by"></i>
                        
                    </a>
                </p>
                
                <p class="control">
                    <a class="button is-white is-large" target="_blank" title="Download on GitHub" href="https://github.com/liyuliang">
                        
                        <i class="fab fa-github"></i>
                        
                    </a>
                </p>
                
                <p class="control">
                    <a class="button is-white is-large" target="_blank" title="SiteMap for Google" href="https://liyuliang.cc/sitemap.xml">
                        
                        <i class="fab fa-google"></i>
                        
                    </a>
                </p>
                
                <p class="control">
                    <a class="button is-white is-large" target="_blank" title="SiteMap for Baidu" href="https://liyuliang.cc/baidusitemap.xml">
                        
                        <i class="fab fa-bimobject"></i>
                        
                    </a>
                </p>
                
                </div>
            
            </div>
        </div>
    </div>
</footer>

    <script src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/moment@2.22.2/min/moment-with-locales.min.js"></script>
<script>moment.locale("en");</script>


    
    
    
    <script src="/js/animation.js"></script>
    

    
    
    
    <script src="https://cdn.jsdelivr.net/npm/lightgallery@1.6.8/dist/js/lightgallery.min.js" defer></script>
    <script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js" defer></script>
    <script src="/js/gallery.js" defer></script>
    

    
    

<div id="outdated">
    <h6>Your browser is out-of-date!</h6>
    <p>Update your browser to view this website correctly. <a id="btnUpdateBrowser" href="http://outdatedbrowser.com/">Update
            my browser now </a></p>
    <p class="last"><a href="#" id="btnCloseUpdateBrowser" title="Close">&times;</a></p>
</div>
<script src="https://cdn.jsdelivr.net/npm/outdatedbrowser@1.1.5/outdatedbrowser/outdatedbrowser.min.js" defer></script>
<script>
    document.addEventListener("DOMContentLoaded", function () {
        outdatedBrowser({
            bgColor: '#f25648',
            color: '#ffffff',
            lowerThan: 'flex'
        });
    });
</script>


    
    
<script src="https://cdn.jsdelivr.net/npm/mathjax@2.7.5/unpacked/MathJax.js?config=TeX-MML-AM_CHTML" defer></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
    MathJax.Hub.Config({
        'HTML-CSS': {matchFontHeight: false},
        SVG: {matchFontHeight: false},
        CommonHTML: {matchFontHeight: false}
    });
});
</script>

    
    

<a id="back-to-top" title="Back to Top" href="javascript:;">
    <i class="fas fa-chevron-up"></i>
</a>
<script src="/js/back-to-top.js" defer></script>


    
    

    
    
    
    

    
    
    
    
    
    <script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.4/dist/clipboard.min.js" defer></script>
    <script src="/js/clipboard.js" defer></script>
    

    


<script src="/js/main.js" defer></script>

    
    <div class="searchbox ins-search">
    <div class="searchbox-container ins-search-container">
        <div class="searchbox-input-wrapper">
            <input type="text" class="searchbox-input ins-search-input" placeholder="Type something...">
            <span class="searchbox-close ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
        </div>
        <div class="searchbox-result-wrapper ins-section-wrapper">
            <div class="ins-section-container"></div>
        </div>
    </div>
</div>
<script>
    (function (window) {
        var INSIGHT_CONFIG = {
            TRANSLATION: {
                POSTS: 'Posts',
                PAGES: 'Pages',
                CATEGORIES: 'Categories',
                TAGS: 'Tags',
                UNTITLED: '(Untitled)',
            },
            CONTENT_URL: '/content.json',
        };
        window.INSIGHT_CONFIG = INSIGHT_CONFIG;
    })(window);
</script>
<script src="/js/insight.js" defer></script>
<link rel="stylesheet" href="/css/search.css">
<link rel="stylesheet" href="/css/insight.css">
    
</body>
</html>